package com.bishe.demo.modules.other.dao;

import com.bishe.demo.modules.other.entity.SceneryImage;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SceneryImageDao {
    @Insert("insert into other_scenery_image values(null,#{sceneryId},#{imageId})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertSceneryImage(SceneryImage sceneryImage);

    @Delete("delete from other_scenery_image where scenery_id=#{sceneryId}")
    void deleteSceneryImageBySceneryId(int sceneryId);

    @Delete("delete from other_scenery_image where image_id=#{imageId}")
    void deleteSceneryImageByImageId(int imageId);

    @Select("select image_id from other_scenery_image where scenery_id=#{sceneryId}")
    List<Integer> getImagesIds(int sceneryId);
}
